html {
  position: relative;
  margin: 0;
  padding: 0;
  min-height: 100%;
  display: flex;
  align-items: stretch;
}

body {
  margin: 0;
  min-height: 100%;
  box-sizing: border-box;
  background: #fafafa;
  flex: 1 1 auto;
  display: flex;
  flex-flow: column nowrap;
}

body,
input,
textarea {
  font-family: 'Cascadia Mono', Consolas, 'Lucida Console', 'San Francisco Mono', Menlo, Monaco, 'Andale Mono',
    'DejaVu Sans Mono', 'Jetbrains Mono NL', monospace;
  line-height: 1.5;
}

a {
  text-decoration: none;
}
a:hover {
  text-decoration: underline;
}

.received {
  flex: 1 1 auto;
  padding: 1em 1em 0 1em;
}
.received:empty::before {
  content: '';
  display: block;
  border-bottom: 5px rgba(44, 149, 234, 0.2) solid;
}

.received > * {
  display: flex;
  align-items: flex-start;
  flex-flow: row nowrap;
  border: solid rgba(200, 200, 200, 0.2);
  border-width: 0 0 1px 0;
}
.received > *:first-child {
  border-top-width: 1px;
}

@keyframes opacity01 {
  from {
    opacity: 0;
  }
  to {
    opacity: 1;
  }
}
.received > .new {
  animation: ease-in 200ms opacity01;
}

.received > * > * {
  padding: 0.25em 0;
}

.received > * > :not(:last-child) {
  flex: 0 0 auto;
  white-space: nowrap;
  min-width: 4em;
  color: #888;
  margin-right: 1em;
}

.received > * > button {
  position: sticky;
  top: 0;
  margin-top: 0.25em;
}

@keyframes bubbleup {
  10% {
    transform: translateY(-10%) rotate(30deg);
  }
  65% {
    opacity: 1;
    transform: translateY(-10%) rotate(30deg);
  }
  100% {
    opacity: 0;
    transform: translateY(-100%) rotate(30deg);
  }
}

.received > * > button em {
  position: absolute;
  right: 5%;
  bottom: 55%;
  width: 5px;
  height: 10px;
  border: 2px #32b357 solid;
  border-top-color: transparent;
  border-left-color: transparent;
  transform: rotate(30deg);
  animation: bubbleup 700ms linear forwards;
}

.received > * > :last-child {
  white-space: pre-wrap;
  word-wrap: break-word;
  word-break: break-all;
}

.received > .last-read:not(:last-child) {
  border-bottom-width: 5px;
  border-bottom-color: rgba(255, 251, 0, 0.5);
}

.sending {
  position: sticky;
  bottom: 0;
  display: flex;
  flex-flow: row nowrap;
  align-items: stretch;
  height: 3em;
  margin: 0;
  padding: 1em;
  background: inherit;
}

.sending .saying {
  flex: 1 1 auto;
  margin: 0;
  padding: 0.2em;
  line-height: 1.5;
  border: 1px #ccc solid;
  resize: none;
}

.sending .submit {
  width: 5em;
  height: 100%;
  margin: 0 0 0 1em;
  padding: 0;
}

@media (prefers-color-scheme: light) {
  html {
    color-scheme: light;
  }
}

@media (prefers-color-scheme: dark) {
  html {
    color-scheme: dark;
  }

  body {
    color: #ccc;
    background: #111;
  }
}
